package com.one.controller;

import com.one.bo.EvaluationBo;
import com.one.service.CommonService;
import com.one.dto.Result;
import com.one.utils.TokenUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/common")
public class CommonController {
    private final CommonService commonService;
    public CommonController(CommonService commonService) {
        this.commonService = commonService;
    }
    
    @ApiOperation(value = "状态枚举", notes = "状态枚举")
    @GetMapping("/getStatus")
    public Result getStatus() {
        return commonService.getStatus();
    }
    @ApiOperation(value = "性别枚举", notes = "性别枚举")
    @GetMapping("/getSex")
    public Result getSex() {
        return commonService.getSex();
    }
    @ApiOperation(value = "系统内置角色枚举", notes = "系统内置角色枚举")
    @GetMapping("/getRole")
    public Result getRole() {
        return commonService.getRole();
    }
    @ApiOperation(value = "是否指标叶子节点枚举", notes = "是否指标叶子节点枚举")
    @GetMapping("/getIsLeafNode")
    public Result getIsLeafNode() {
        return commonService.getIsLeafNode();
    }
    @ApiOperation(value = "有效班级", notes = "有效班级")
    @GetMapping("/getClassInfo")
    public Result getClassInfo() {
        return commonService.getClassInfo();
    }

    @ApiOperation(value = "学生还是老师", notes = "学生还是老师")
    @GetMapping("/getMeStuentOrTeacher")
    public Result getMeStuentOrTeacher(HttpServletRequest request) {
        String userID = TokenUtils.getUserID(request);
        return commonService.getMeStuentOrTeacher(userID);
    }

    @ApiOperation(value = "有效批次", notes = "有效批次")
    @GetMapping("/getSems")
    public Result getSems() {
        return commonService.getSems();
    }
}
